<input #file type="file" (change)="newFileChoose(file)" style="display: none">

<ng-template #defaultToolbarTemplate let-toolbar="">
  <div class="file-upload-toolbar">
    <button class="btn btn-primary" (click)="toolbar.addNewFile($event)"
            [disabled]="toolbar.isMoreThanMaxItems()">
      <i class="file-upload-toolbar-choose {{plusIcon}}"></i> {{toolbar.chooseButton}}
    </button>
    <button class="btn btn-info" [disabled]="!toolbar.selectFiles?.length" (click)="toolbar.uploadAllFiles()">
      <i class="file-upload-toolbar-upload {{uploadIcon}}"></i> {{toolbar.uploadButton}}
    </button>
    <button class="btn btn-danger" [disabled]="!toolbar.selectFiles?.length" (click)="toolbar.removeAllSelectedFiles()">
      <i class="file-upload-toolbar-remove {{removeIcon}}"></i> {{toolbar.cancelButton}}
    </button>
  </div>

</ng-template>

<ng-template #defaultPreviewTemplate let-preview="">

  <hi-file-upload-preview [selectFiles]="preview.selectFiles" [imgPreview]="preview.imgPreview"
                          [previewWidth]="preview.previewWidth"
                          (removeFile)="preview.onRemoveFile($event)"></hi-file-upload-preview>

  <hi-file-upload-preview [selectFiles]="preview.uploadFiles" [imgPreview]="preview.imgPreview"
                          [previewWidth]="preview.previewWidth"
                          (removeFile)="preview.onRemoveUploadFile($event)"
                          [uploaded]="true"></hi-file-upload-preview>
</ng-template>

<div class="file-upload {{cssClass}}" reDroppable (onDrop)="onDropFiles($event)">

  <ng-template [ngTemplateOutlet]="toolbarTemplate || defaultToolbarTemplate"
               [ngTemplateOutletContext]="{ $implicit: this}"></ng-template>


  <hi-alert-box class="file-upload-error-box" type="danger" [closable]="true" (close)="clearErrors()"
                *ngIf="showErrors && errors.length">
    <ul>
      <li *ngFor="let error of errors">{{error}}</li>
    </ul>
  </hi-alert-box>

  <ng-template [ngTemplateOutlet]="previewTemplate || defaultPreviewTemplate"
               [ngTemplateOutletContext]="{ $implicit: this}"></ng-template>

</div>
